package com.zyf.swordRefersOffer;

public class TryFinallyTest {

	// public static int i = 1;
	//
	// public static int ret() {
	// try {
	// i = 2;
	// return (++i);
	// } catch (Exception e) {
	// e.printStackTrace();
	// } finally {
	// i = 10;
	// System.out.println("fially i=" + i);
	// }
	// return 0;
	// }
	//
	// public static void main(String[] args) {
	// System.out.println("ret返回的值 =" + ret());
	// System.out.println("最后的值 = " + i);
	// }

	/**
	 * 引用类型测试
	 */
	public static StringBuilder stringBuilder = new StringBuilder();

	public static StringBuilder ret() {
		try {
			stringBuilder.append("a");
			return stringBuilder.append("b");
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			stringBuilder.append("c");
		}
		return stringBuilder;
	}

	public static void main(String[] args) {
		System.out.println("ret要返回的值 =" + ret());
	}
}
